<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="login">
    <h1>登录</h1>
    <font color="red" th:text="${msg}"></font>
    <form class="layui-form"  method="post" action="/user/login">
        <div class="layui-form-item">
            <input class="layui-input" name="userName" value="admin" placeholder="用户名"  type="text"
                   autocomplete="off">
        </div>
        <div class="layui-form-item">
            <input class="layui-input" name="password" value="" placeholder="密码"
                   type="password" autocomplete="off">
        </div>

            <div class="col-xs-6">
                <input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" autocomplete="off">
                <a href="javascript:void(0);" title="点击更换验证码">
                    <img th:src="@{captcha/captchaImage(type='char')}" onclick="this.src=/captcha/" class="imgcode" />
                </a>
            </div>

        <!--  <div class="layui-form-item form_code">
              <input class="layui-input" name="verifyCodeActual" placeholder="验证码" lay-verify="required" type="text"
                     autocomplete="off">
              <div class="code"><img id="captcha_img" alt="点击更换" title="点击更换" onclick="refresh()"  src="/captcha/getCaptcha.jpg" width="116" height="36"/>
              </div>
          </div>-->
        <div class="layui-form-item">
            记住我：<input type="checkbox" name="rememberMe" title="记住我"  value="1">
        </div>
        <input type="submit" value="登录">
    </form>
</div>
</body>
<script type="text/javascript" th:src="@{/plugins/jquery/jquery-3.2.1.min.js}"></script>

</html>

<script>
    $(function() {
        var captchaType = "char";
        $('.imgcode').click(function() {
            var url ="captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
            $(".imgcode").attr("src", url);
        });
    });

</script>